package com.code.base.state.service;

import java.util.List;
import java.util.Date;
import java.util.Map;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.code.base.state.persistence.StateHandleMapper;
import com.code.base.state.pojo.StateHandle;
import com.code.util.PrimaryKeyUtil;


@Service
public class StateHandleService {


	@Resource
	private StateHandleMapper stateHandleMapper;

	public Long getInsertId() {
		return PrimaryKeyUtil.generatePrimaryKey();
	}

	public StateHandle getDataById(Long id) {
		return stateHandleMapper.getDataById(id);
	}

	public List<StateHandle> getAllData() {
		return stateHandleMapper.getAllData();
	}

	public int getDataCountByCondition(StateHandle entity) {
		return stateHandleMapper.getDataCountByCondition(entity);
	}

	public List<StateHandle> getDataByCondition(StateHandle entity) {
		return stateHandleMapper.getDataByCondition(entity);
	}

	public int getDataCountByLikeCondition(StateHandle entity) {
		return stateHandleMapper.getDataCountByLikeCondition(entity);
	}

	public List<StateHandle> getDataByLikeCondition(StateHandle entity) {
		return stateHandleMapper.getDataByLikeCondition(entity);
	}

	public List<StateHandle> getDataByIds(Long[] ids) {
		return stateHandleMapper.getDataByIds(ids);
	}

	public void insertData(StateHandle entity) {
		insertData(entity, true);
	}

	public void insertData(StateHandle entity, boolean setIdValue) {
		if (setIdValue) {
			entity.setId(getInsertId());
		}
		stateHandleMapper.insertData(entity);
	}

	public void updateData(StateHandle entity) {
		stateHandleMapper.updateData(entity);
	}

	public void updateDataByParam(Map<String, Object> map) {
		if (map.size() == 0)
			return;

		stateHandleMapper.updateDataByParam(map);
	}

	public void deleteDataByObject(StateHandle entity) {
		stateHandleMapper.deleteDataByObject(entity);
	}

	public void deleteDataById(Long id) {
		stateHandleMapper.deleteDataById(id);
	}

	public void deleteDataByIds(Long[] ids) {
		stateHandleMapper.deleteDataByIds(ids);
	}

}
